package com.childenglish.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

@Mapper
public interface ParentChildRelationMapper {

    @Select("SELECT COUNT(*) FROM parent_child_relation WHERE parent_id = #{parentId} AND child_id = #{childId}")
    boolean existsByParentIdAndChildId(Long parentId, Long childId);

    @Select("SELECT child_id FROM parent_child_relation WHERE parent_id = #{parentId}")
    List<Long> selectChildIdsByParentId(Long parentId);
}